/*
 * @Author: your name
 * @Date: 2020-11-18 11:05:39
 * @LastEditTime: 2020-11-30 16:22:40
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \sdvideo-ui\src\api\cameraadmin\cameramap.js
 */
/*
 * 摄像机地图
 */
import request from '@/utils/request'
import Axios from 'axios'

// 查询组织-监控点树
export function queryOrgCameraTree(query) {
  return request({
    url: 'http://10.166.147.60:9021/system/dept/deptcamtreeselect',
    method: 'get',
    headers: {
      isVideoToken: false,
    },
    params: query
  })
}
// 查询摄像机组织，不包含摄像机
export function queryOrgCameraOrg(query) {
  return request({
    url: 'http://10.166.147.60:9021/system/dept/depttreeselect',
    method: 'get',
    headers: {
      isVideoToken: false,
    },
    params: query
  })
}
// 根据组织查询改组织下所有摄像机
export function queryAllCameraByOrgId(query) {
  return request({
    url: 'http://10.166.147.60:9021/system/dept/queryAllCameraByOrgId',
    method: 'get',
    headers: {
      isVideoToken: false,
    },
    params: query
  })
}

// 视频下载 点播视频页面
export function downloadVideo(data) {
  return request({
    timeout:50000,
    url: 'http://10.166.147.60:9021/mechanism/server/recordingAndDownloading?cameraNum=' + data.cameraNum + '&streamUrl=' + data.streamUrl,
    method: 'post',
    headers: {
      isVideoToken: false,
    },
    responseType: 'blob'
  })
}

// 根据组织查询该组织下所有摄像机 按道路
export function queryAllCameraByRoad(data) {
  return request({
    url: 'http://10.166.147.60:9021/dashboard/rtMonitor/getCameraByRoadCode?roadCode=' + data.roadCode,
    method: 'post',
    headers: {
      isVideoToken: false,
    },
  })
}

// 智慧监测和资源统计页面左侧按道路获取摄像机列表
export function queryCameraByRoad2(data) {
  return request({
    url: 'http://10.166.147.60:9021/system/dept/depttreeselect?orgTreeType=2',
    method: 'get',
    headers: {
      isVideoToken: false,
    },
  })
}

// 首页右下方 查询视频左右滑动列表、按事件获取摄像机 打点
export function queryIndexRightBottom(data) {
  return request({
    url: 'http://10.166.147.60:9021/dashboard/rtMonitor/eventList',
    method: 'get',
    headers: {
      isVideoToken: false,
    },
    params: data
  })
}

// 查询摄像机状态 按道路
export function queryCameraStasticsByRoad(data) {
  return request({
    url: 'http://10.166.147.60:9021/dashboard/rtMonitor/getCameraStatusStatisticsRoad?roadCode=' + data.roadCode,
    method: 'get',
    headers: {
      isVideoToken: false,
    },
  })
}

// 查询摄像机 播放流
export function getVideoStream(query) {
  return request({
    timeout:15000,
    url: 'http://10.166.147.60:9021/mechanism/server/getVideoStream',
    method: 'get',
    headers: {
      isVideoToken: false,
    },
    params: query,
  })
}
// 摄像机运行状态统计
export function getCameraStatusStatistics(query) {
  return request({
    url: 'http://10.166.147.60:9021/dashboard/rtMonitor/getCameraStatusStatistics',
    method: 'get',
    headers: {
      isVideoToken: false,
    },
    params: query
  })
}
// 各市调阅统计
export function getPlayCountByCity (query) {
  return request({
    url: 'http://10.166.147.60:9021/dashboard/rtMonitor/getPlayCountByCity',
    method: 'get',
    headers: {
      isVideoToken: false,
    },
    params: query
  })
}

//根据组织查询摄像机
export function getcamera (query) {
  return request({
    url: 'http://10.166.147.60:9021/dashboard/rtMonitor/getcamera',
    method: 'post',
    headers: {
      isVideoToken: false,
    },
    params: query
  })
}

// 摄像机操作控制接口
export function cameraHandle(data) {
  return request({
    url: 'http://10.166.147.60:9021/home/PTZControl',
    method: 'post',
    headers: {
      isVideoToken: false,
    },
    data
  })
}

//摄像机截图 /dashboard/rtMonitor//
export function picListList(query){
  return request({
    url: 'http://10.166.147.60:9021/dashboard/rtMonitor/picListList',
    method: 'get',
    headers: {
      isVideoToken: false,
    },
    params: query
  })
}
// 摄像机详情接口
export function camNumsInfo(id) {
  return request({
    url: '/system/camera/' + id,
    method: 'get',
  })
}

//智能运维
export function camInfo(data){
  return request({
    url: 'http://10.166.147.60:9021/dashboard/maintain/getCameraBase',
    method: 'post',
    headers: {
      isVideoToken: false,
    },
    params: data
  })
}
